package acwing;

import java.io.*;
import java.util.*;

public class ac3305 {
    static StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
    static PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
    static BufferedReader bin = new BufferedReader(new InputStreamReader(System.in));
    static final int N = 2010, M = 200050 + N, INF = 0x3f3f3f3f;
    static int n, m, k, target, idx;
    static int[] h = new int[N], ne = new int[M], e = new int[M], w = new int[M], g = new int[M];
    static int[] t = new int[N], d = new int[N];
    static boolean[] st = new boolean[N];


    static int cin() throws IOException {
        in.nextToken();
        return (int) in.nval;
    }

    static void add(int a, int b, int c) {
        e[idx] = c;
        w[idx] = Math.max(t[a], t[b]);
        ne[idx] = h[a];
        g[idx] = b;
        h[a] = idx ++ ;
    }

    static int spfa(){
        Arrays.fill(d, INF);
        Queue<Integer> q = new LinkedList<>();
        q.offer(0);
        st[0] = true;
        d[0] = 0;
        while (!q.isEmpty()) {
            int tmp = q.poll();
            st[tmp] = false;
            for (int i = h[tmp]; i != -1; i = ne[i] ) {
                int ver  = e[i];
                if (d[ver] > Math.max(d[tmp], d[g[i]]) + w[i]) {
                    d[ver] = Math.max(d[tmp], d[g[i]]) + w[i];
                    if (!st[ver ]) {
                        q.offer(ver );
                        st[ver ] = true;
                    }
                }
            }
        }
        return d[target];
    }

    public static void main(String[] args) throws IOException {
        Arrays.fill(h, -1);
        n = cin(); m = cin(); k = cin(); target = cin();
        for (int i = 1; i <= n; i ++ ) t[i] = cin();
        for (int i = 1; i <= m; i ++ ) {
            int x = cin();
            add(0, 0, x);
        }
        while (k -- > 0) {
            int a = cin(), b = cin(), c = cin();
            add(a, b, c); add(b, a, c);
        }

        out.println(spfa());
        out.close();
    }
}